add_executable(hello_world hello_world.cpp)

set(CMAKE_CXX_STANDARD 17)
set(OpenCV_DIR "/usr/local/opencv-4.12.0/lib/cmake/opencv4")

find_package(OpenCV REQUIRED)
find_package(PCL REQUIRED common io visualization filters)
find_package(yaml-cpp REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(g2o REQUIRED)
# find_package(CSparse REQUIRED)

include_directories(${G2O_INCLUDE_DIRS})
include_directories(${EIGEN3_INCLUDE_DIR})
add_definitions(${PCL_DEFINITIONS})
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/include)

add_executable(generatePointCloud generatePointCloud.cpp)
target_link_libraries(generatePointCloud ${OpenCV_LIBS} ${PCL_LIBRARIES})

add_library(slamBase SHARED slamBase.cpp)
target_link_libraries(slamBase ${OpenCV_LIBS} ${PCL_LIBRARIES} ${YAML_CPP_LIBRARIES})

add_executable(detectFeatures detectFeatures.cpp)
target_link_libraries(detectFeatures slamBase)

add_executable(joinPointCloud joinPointCloud.cpp)
target_link_libraries(joinPointCloud slamBase)

add_executable(visualOdometry visualOdometry.cpp)
target_link_libraries(visualOdometry slamBase)

add_executable(slamEnd slamEnd.cpp)
target_link_libraries(slamEnd slamBase g2o_core g2o_types_slam3d g2o_stuff)

add_executable(slam slam.cpp)
target_link_libraries(slam slamBase g2o_core g2o_types_slam3d g2o_stuff)